summaryrefslogtreecommitdiff
path: root/app/[lng]/partners/site-visit/page.tsx
blob: 92580b35bfc3d0cde386bd24d89d2d270f26931d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { getServerSession } from "next-auth"
import { authOptions } from "@/app/api/auth/[...nextauth]/route"
import { getSiteVisitRequestsByVendorId } from "@/lib/site-visit/service"
import { ClientSiteVisitWrapper } from "@/lib/site-visit/client-site-visit-wrapper"
import { unstable_noStore as noStore } from 'next/cache'

// 페이지가 기본적으로 동적임을 나타냄
export const dynamic = "force-dynamic"

export default async function SiteVisitPage() {
  // Opt out of caching for this route
  noStore()
  
  // 세션
  const session = await getServerSession(authOptions)
  // 세션에서 vendorId 가져오기
  const vendorId = session?.user.companyId
  const idAsNumber = Number(vendorId)
  
  // 방문실사 요청 목록 가져오기
  const siteVisitRequests = await getSiteVisitRequestsByVendorId(idAsNumber)
  
  // 클라이언트 컴포넌트로 데이터 전달
  return (
    <ClientSiteVisitWrapper
      siteVisitRequests={siteVisitRequests}
      vendorId={idAsNumber}
    />
  )
}